//
//  ImageButton.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 17/1/8.
//  Copyright © 2017年 com.xtion.crm. All rights reserved.
//

#import "MixedImageButton.h"

@interface MixedImageButton()
{
    XUIButton *_button;
    
    UIImageView *_deleteImageView;
}

@end

@implementation MixedImageButton

@synthesize szTag;

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    self.userInteractionEnabled = NO;
    
    _button = [XUIButton buttonWithStyleType:XUIButtonStyleTypeCenterImage delegate:self];
    _button.frame = self.bounds;
    [self addSubview:_button];
    
    _deleteImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"headviewpanel_deletetag.png"]];
    _deleteImageView.hidden = YES;
    [self addSubview:_deleteImageView];
    
    return self;
}

-(void)layoutSubviews
{
    _button.frame = self.bounds;
    
    _deleteImageView.center = CGPointMake(_button.right, _button.top);
}

-(void)setHiddenDeleteTag:(BOOL)hiddenDeleteTag
{
    _deleteImageView.hidden = hiddenDeleteTag;
}

-(void)setImage:(UIImage *)image
{
    [_button SetImage:image];
}

@end
